package com.usian.model.annotaiton;

import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigurationExcludeFilter;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.boot.context.TypeExcludeFilter;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.core.annotation.AliasFor;

import java.lang.annotation.*;

@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@SpringBootConfiguration
@EnableAutoConfiguration
@ComponentScan(
        excludeFilters = {@ComponentScan.Filter(
                type = FilterType.CUSTOM,
                classes = {TypeExcludeFilter.class}
        ), @ComponentScan.Filter(
                type = FilterType.CUSTOM,
                classes = {AutoConfigurationExcludeFilter.class}
        )}
)
public @interface SpringBootApplicationWithoutDataBaseAutoConfiguration {
        @AliasFor(
                annotation = EnableAutoConfiguration.class
        )
        Class<?>[] exclude() default {MongoAutoConfiguration.class, MongoDataAutoConfiguration.class};

        @AliasFor(
                annotation = EnableAutoConfiguration.class
        )
        String[] excludeName() default {};

        @AliasFor(
                annotation = ComponentScan.class,
                attribute = "basePackages"
        )
        String[] scanBasePackages() default {};

        @AliasFor(
                annotation = ComponentScan.class,
                attribute = "basePackageClasses"
        )
        Class<?>[] scanBasePackageClasses() default {};
}
